//
//  HZAddCaseView.m
//  MyDoctor
//
//  Created by 徐彩东 on 16/5/5.
//  Copyright © 2016年 heiyan. All rights reserved.
//

#import "HZAddCaseView.h"

@interface HZAddCaseView ()

///  添加按钮
@property (nonatomic , strong) UIButton *addBtn;

///  文本
@property (nonatomic , strong) UILabel *textLabel;

@end

@implementation HZAddCaseView

-(instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        //设置界面
        [self setupUI];
    }
    return  self;
}

#pragma mark - 设置界面
-(void)setupUI{

    //设置背景颜色
    self.backgroundColor = [UIColor whiteColor];
    
    //添加子控件
    [self addSubview:self.addBtn];
    [self addSubview:self.textLabel];
    
    //约束
    [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.centerY.equalTo(self);
    }];
    
    [self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(self.textLabel.mas_left).equalTo(-10);
    }];
    
}

#pragma mark - 懒加载
-(UIButton *)addBtn{

    if (!_addBtn) {
        
        _addBtn = [UIButton buttonWithType:UIButtonTypeContactAdd];
        [_addBtn setTintColor:[UIColor colorWithRed:112/255.0 green:201/255.0 blue:201/255.0 alpha:1.0]];

        //添加点击事件
        [_addBtn addTarget:self action:@selector(didClickAddBtn) forControlEvents:UIControlEventTouchUpInside];
    }
    return _addBtn;
}

-(UILabel *)textLabel{

    if (!_textLabel) {
        
        _textLabel = [[UILabel alloc]initWithTitle:@"添加病例" WitthTextFont:18 WithTextColor:[UIColor colorWithRed:112/255.0 green:201/255.0 blue:201/255.0 alpha:1.0]];
    }
    return _textLabel;
}

#pragma mark - 实现点击按钮Btn事件
-(void)didClickAddBtn{
 
    if ([self.delegate respondsToSelector:@selector(addCaseView:)]) {
        
        //调用代理方法
        [self.delegate addCaseView:self];
        
    }
    
}

@end























